package com.leetone.microserver;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@EnableEurekaClient
@SpringBootApplication
@RestController
public class MicroserverEurekaUserApplication {

    @RequestMapping("/hello")
    public String home() {
        return "hello world!";
    }

    public static void main(String[] args) {
        SpringApplication.run(MicroserverEurekaUserApplication.class, args);
    }

    /*
     * @description 【RestTemplate是Spring提供的用于访问Rest服务的客户端实例，
     * 它提供了多种便捷访问远程http服务的方法，能大大提高客户端的编写效率】
     * @param
     * @return org.springframework.web.client.RestTemplate
     * @exception
     * @author leetone 【leetone123@163.com】
     * @date 2019/3/13 23:41
     */
    @Bean
    @LoadBalanced
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }
}
